-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract EditorDockManager
from EditorNode
#84193
Conversation
Why is it a node at all? There is no reason for this. It should only handle the docks themselves, and if you insert it as a node and as a node in this particular place, it automatically becomes a parent to not only docks, but also to the main editor and the bottom panel. I think docks and dockable splits should be made into a reusable control, and a manager class can be introduced to handle them without becoming a key node in the editor layout tree. Edit: This allows us to have a modular approach when it comes to how the layout works. This will be important if we want to make floating windows into mini editors with their own dockable areas. |
I only made it a node so it can take all of the I was going to look into doing godotengine/godot-proposals#1984 later, but I like your modular idea so I'll look into that. |
I have plans to completely divorce the UI part of the editor from But that shouldn't affect your PR much. I just don't think that making a dock manager a root of most UI is correct for its functionality. Edit: By the way, feel free to tag me on RocketChat if you want to figure out a solution together! |
9de5339
to
3d2d34a
Compare
Cool. I actually wanted to do this after #62378, but I didn't find the time. |
@trollodel after #84122 is merged, I'll rebase this and then I think it will be ready for review |
You can rebase this now and we can look into getting it across the finish line 🙂 |
3d2d34a
to
9224e0c
Compare
Rebased and updated initial comment to be accurate to the changes. The Dock Manager is now an Object and the dock slots are passed into it from the EditorNode. The Dock Manager still handles all of the dock select Controls. Added DockSplitContainer to handle automatically showing and hiding the SplitContainer. |
Hmm, this is how master looks for me: Looking at Edit: |
EditorDockManager::EditorDockManager() { | ||
singleton = this; | ||
|
||
dock_select_popup = memnew(PopupPanel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This popup (with all of its layout) could probably be extracted into its own class, it contains plenty of code which doesn't need to be shared.
You also won't need to connect to theme_changed
this way, you will be able to use the notification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That said, this can probably be done in a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes are necessary, but overall this is a very clean and welcome extraction. Great job!
Regarding the drawing of the popup the code seems identical to me. But it's not great to begin with, it doesn't account for the scale, I think. So glitches are possible, and I'm pretty sure I've seen it misbehave like that before. It needs a lot of improvements, really, but I don't think this PR breaks it. |
91f5082
to
0db8642
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, aside from the missing empty line.
0db8642
to
2323f04
Compare
Thanks! |
Moves most code about docks, dock management, and dock select popup from
EditorNode
toEditorDockManager
.There should be no behavioral changes in this pr.
Details
EditorDockManager
singleton to encapsulate docks and dock select logic fromEditorNode
EditorNode
passes the dock slots and dock splits toEditorDockManager
DockSplitContainer : SplitContainer
that automatically shows if any children are visible, otherwise it hidesEditorNode
still adds the Scene, FileSystem, and other docks but it usesEditorDockManager
to do it.save_docks_to_config
,load_docks_from_config
,update_dock_slots_visibility
public inEditorDockManager
to be accessible fromEditorNode
.close_all_floating_docks
as part of the workaround for Godot crashes when changing Editor Features when certain docks are floating #84125. This can be removed after the proper fix, if wanted.layout_changed
inEditorDockManager
to triggerEditorNode::_save_editor_layout()
. This could probably be changed toEditorNode::get_singleton()->save_editor_layout_delayed()
if the delay is fine.EditorPlugin
andVersionControlEditorPlugin
now useEditorDockManager
to add and remove docksadd_control_to_dock
, since the default docks use a custom title on the tabs. This is not exposed to users.ofs
->p_offset
,p_which
->p_dock_slot
)